package com.bosssoft.boss_exam_db.validator.common;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import java.util.regex.Pattern;

/***
 * @Author lys(cherish)
 * @Phone 17720799636
 * @Date  2019/3/13
 * @Descriptionh 手机校验类
 **/
public class PhoneValidator implements ConstraintValidator<Phone, String> {

    private static  Pattern PHONE_PATTERN =null;

    @Override
    public void initialize(Phone constraintAnnotation) {
//        PHONE_PATTERN= compile("^((13[0-9])|(15[^4])|(18[0,2,3,5-9])|(17[0-8])|(147))\\d{8}$");
    }

    @Override
    public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) {
        if ( value == null || value.length() == 0 ) {
            return false;
        }
//        Matcher m = PHONE_PATTERN.matcher(value);
//        return m.matches();
        return true;
    }
}
